package com.xuecheng.content.domain.feignclient;

import com.xuecheng.content.domain.feignclient.fallback.MediaServiceClientFallback;
import com.xuecheng.content.domain.feignclient.fallback.MediaServiceClientFallbackFactory;
import com.xuecheng.content.infrastructure.config.MultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

//@FeignClient(value = "media-service", configuration = MultipartSupportConfig.class, fallback = MediaServiceClientFallback.class)
@FeignClient(value = "media-service", configuration = MultipartSupportConfig.class, fallbackFactory = MediaServiceClientFallbackFactory.class)
public interface MediaServiceClient {

    @PostMapping(value = "/media/upload/coursefile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String upload(@RequestPart("filedata") MultipartFile multipartFile,
                  @RequestParam(value = "objectName", required = false) String objectName);



}
